package com.qfedu.stussm.controller;

import com.qfedu.stussm.dto.LoginDto;
import com.qfedu.stussm.entity.Admin;
import com.qfedu.stussm.service.intf.AdminService;
import com.qfedu.stussm.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("api/stu/")
public class AdminController {
    @Autowired
    private AdminService service;
    @PostMapping ("login.do")
    public R login(LoginDto dto, HttpSession session){
        return service.login(dto,session);
    }
    @PostMapping("update.do")
    public R update (Admin admin) {
        System.out.println(admin);
        return service.update(admin);
    }
    @PostMapping("updatePwd.do")
    public R pass(String oldPwd,String newPwd,HttpSession session){
        System.out.println(oldPwd+newPwd);
        return service.updatePwd(oldPwd,newPwd,session);
    }
}
